#include<iostream>
#include<unistd.h>
#include<signal.h>
#include<cstdlib>
void handler(int signum)
{
    std::cout << "hello signal: " << signal << std::endl;
    while(true)
    {
        sigset_t pending;
        sigpending(&pending);
        std::cout << "pid" << getpid() << ",";
        for(int i = 32; i >= 1; i--)
        {
            if(sigismember(&pending,i)) std::cout << 1;
            else std::cout << 0;
            
        }
        std::cout << std::endl;
        sleep(1);
    }
    exit(0);
}
int main()
{
    struct sigaction act,oact;
    act.sa_handler = handler;
    sigemptyset(&act.sa_mask);
    sigaddset(&act.sa_mask,3);
    sigaddset(&act.sa_mask,4);
    act.sa_flags = 0;
    sigaction(SIGINT,&act,&oact);
    while(true)
    {
        std::cout << "hello word" << std::endl;
        sleep(1);
    }
}